<template>
  <div>
    <!-- 顶部导航栏 -->
    <van-nav-bar
      title="医院详情"
      left-arrow
      @click-left="$router.go(-1)"
    />
    <!-- 背景灰色盒子 -->
    <div class="greybox">
      <!-- 上方总盒子 -->
      <div class="inalltopbox">
        <!-- 医院详情介绍 -->
        <div class="topdetail">
          <!-- 上半块 -->
          <div class="topbox">
            <van-image
              width="5rem"
              height="5rem"
              :src="`/images/${hospitallist.image}`"
            />
            <div class="tag">三甲</div>
          </div>
          <!-- 下半块 -->
          <div class="bottomdetail">
            <h3>{{ hospitallist.name }}</h3>
            <div>
              <h4>营业时间:</h4>
              <div>
                {{ hospitallist.opening_time }}
              </div>
              <h4>特色科室:</h4>
              <div>
                {{ hospitallist.special_office }}
              </div>
              <h4>医院概况:</h4>
              <div>
                {{ hospitallist.introduction }}
              </div>
            </div>
          </div>
        </div>
      </div>
      <!-- 预约板块 -->
      <div class="inallbottombox">
        <div class="orderbox">
          <div class="ordercard">
            <div>距你{{ hospitallist.distance + "km" }}</div>
            <div>{{ hospitallist.address }}</div>
          </div>
          <div>
            <van-button class="button" round type="info" color="#1074ff" @click="toOrder"
              >去预约</van-button
            >
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      hospitallist: {},
    };
  },
  mounted() {
    let id = this.$route.query.id;

    this.axios
      .get(`${this.$base}hospital/detail?id=${id}`)
      .then((res) => {
        this.hospitallist = res.data.data[0];

      });
  },
  methods: {
    toOrder() {
      let hid = this.$route.query.id
      sessionStorage.setItem('hid', hid)
      this.$router.push('/order')
    }
  },
};
</script>

<style lang="less" scoped>
.van-nav-bar {
  background-color: #1074ff;

  /deep/ .van-nav-bar__title {
    color: #fff;
  }
  /deep/ .van-icon-arrow-left {
    color: #fff;
  }
}
.greybox {
  width: 100%;
  background-color: #f8f8f8;
}
.inalltopbox {
  width: 90%;
  background-color: white;
  margin: auto;
  margin-top: 20px;
}
.topdetail {
  margin-left: 10px;
}
.bottomdetail {
  margin-top: -10px;
}
.topbox {
  display: flex;
}
.tag {
  width: 40px;
  height: 20px;
  background-color: #1074ff;
  color: white;
  text-align: center;
  border-radius: 5px;
  margin: auto 25px;
}
.van-image {
  margin-left: 5px;
  top: -10px;
}
.inallbottombox {
  width: 90%;
  background-color: white;
  margin: auto;
  margin-top: 10px;
}
.orderbox {
  margin-left: 10px;
  overflow: hidden;
}
.ordercard {
  margin-top: 10px;
}
/* .tabber {
  margin-top: 50px;
  overflow: hidden;
} */
.button {
  width: 80vw;
  height: 5vh;
  margin: 10vh auto;
}
</style>